<template>
	<view class="content">
		<view>
			1111全局定义的数据：{{text}}
		</view>
		<button open-type="share" @click="share">分享</button>
		<button @click="getLocation">获取经纬度</button>
		<button @click="goList">列表</button>
		<button@click="goComs">自定义组件qqwwww</button>
			<button @click="zhendong">测试测试测试</button>
			<test></test>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				text: ''
			}
		},
		onShow: function() {
			//获取在app.vue中定义的全局数据
			this.text = getApp().globalData.text
			//console.log(getApp().globalData.text);

		},

		methods: {
			goList() {
				uni.navigateTo({
					url: '/pages/testlist/testlist',
				})
			},

			goComs() {
				uni.navigateTo({
					url: '/pages/testMyComs/testMyComs',
				})
			},

			//允许转发的默认函数
			onShareAppMessage() {},
			// 分享操作
			share() {
				uni.share({
					provider: "weixin",
					scene: "WXSceneSession",
					type: 1,
					summary: "赶紧跟我一起来体验吧！",
					success: function(res) {
						console.log("success:" + JSON.stringify(res));
					},
					fail: function(err) {
						console.log("fail:" + JSON.stringify(err));
					}
				});
			},

			//经纬度
			getLocation() {
				uni.getLocation({
					type: 'wgs84',
					success: function(res) {
						console.log(res);
					},
					fail: function(error) {
						console.error('获取位置失败：', error);
					}
				});
			},


			//
			zhendong() {
				uni.requestSubscribeMessage({
					tmplIds: [''],
					success(res) {}
				})


			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.form-content {
		width: 100%;
		height: auto;
	}

	::v-deep .form-content .u-form-item__body__right_no_flex {
		width: 100%;
		height: auto;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
		margin-top: 100rpx;
	}

	.tips {
		margin-top: 100rpx;
	}
</style>